<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGraphicsSimpleTextItem Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGraphicsSimpleTextItem Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsSimpleTextItem class provides a simple text path
item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractgraphicsshapeitem.html">QAbstractGraphicsShapeItem</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicssimpletextitem.html#QGraphicsSimpleTextItem">__init__</a></b> (<i>self</i>, QGraphicsItem&#160;<i>parent</i>&#160;=&#160;None, QGraphicsScene&#160;<i>scene</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qgraphicssimpletextitem.html#QGraphicsSimpleTextItem-2">__init__</a></b> (<i>self</i>, QString&#160;<i>text</i>, QGraphicsItem&#160;<i>parent</i>&#160;=&#160;None, QGraphicsScene&#160;<i>scene</i>&#160;=&#160;None)</li><li><div class="fn" />QRectF <b><a href="qgraphicssimpletextitem.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicssimpletextitem.html#contains">contains</a></b> (<i>self</i>, QPointF&#160;<i>point</i>)</li><li><div class="fn" />QFont <b><a href="qgraphicssimpletextitem.html#font">font</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicssimpletextitem.html#isObscuredBy">isObscuredBy</a></b> (<i>self</i>, QGraphicsItem&#160;<i>item</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicssimpletextitem.html#opaqueArea">opaqueArea</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicssimpletextitem.html#paint">paint</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionGraphicsItem&#160;<i>option</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" /><b><a href="qgraphicssimpletextitem.html#setFont">setFont</a></b> (<i>self</i>, QFont&#160;<i>font</i>)</li><li><div class="fn" /><b><a href="qgraphicssimpletextitem.html#setText">setText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicssimpletextitem.html#shape">shape</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qgraphicssimpletextitem.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qgraphicssimpletextitem.html#type">type</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsSimpleTextItem class provides a simple text path
item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>.</p>
<p>To set the item's text, you can either pass a <a href="qstring.html">QString</a> to QGraphicsSimpleTextItem's
constructor, or call <a href="qgraphicssimpletextitem.html#setText">setText</a>() to change the
text later. To set the text fill color, call <a href="qabstractgraphicsshapeitem.html#setBrush">setBrush</a>().</p>
<p>The simple text item can have both a fill and an outline;
<a href="qabstractgraphicsshapeitem.html#setBrush">setBrush</a>()
will set the text fill (i.e., text color), and <a href="qabstractgraphicsshapeitem.html#setPen">setPen</a>() sets the pen
that will be used to draw the text outline. (The latter can be
slow, especially for complex pens, and items with long text
content.) If all you want is to draw a simple line of text, you
should call <a href="qabstractgraphicsshapeitem.html#setBrush">setBrush</a>() only, and
leave the pen unset; QGraphicsSimpleTextItem's pen is by default
<a href="qt.html#PenStyle-enum">Qt.NoPen</a>.</p>
<p>QGraphicsSimpleTextItem uses the text's formatted size and the
associated font to provide a reasonable implementation of <a href="qgraphicssimpletextitem.html#boundingRect">boundingRect</a>(),
<a href="qgraphicssimpletextitem.html#shape">shape</a>(), and
<a href="qgraphicssimpletextitem.html#contains">contains</a>(). You
can set the font by calling <a href="qgraphicssimpletextitem.html#setFont">setFont</a>().</p>
<p>QGraphicsSimpleText does not display rich text; instead, you can
use <a href="qgraphicstextitem.html">QGraphicsTextItem</a>, which
provides full text control capabilities.</p>
<p class="centerAlign"><img alt="" src="images/graphicsview-simpletextitem.png" /></p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsSimpleTextItem" />QGraphicsSimpleTextItem.__init__ (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qgraphicsscene.html">QGraphicsScene</a>&#160;<i>scene</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a>.</p>
<p><i>parent</i> is passed to <a href="qgraphicsitem.html">QGraphicsItem</a>'s constructor.</p>
<p><b>See also</b> <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>().</p>


<h3 class="fn"><a name="QGraphicsSimpleTextItem-2" />QGraphicsSimpleTextItem.__init__ (<i>self</i>, QString&#160;<i>text</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qgraphicsscene.html">QGraphicsScene</a>&#160;<i>scene</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a>, using
<i>text</i> as the default plain text.</p>
<p><i>parent</i> is passed to <a href="qgraphicsitem.html">QGraphicsItem</a>'s constructor.</p>
<p><b>See also</b> <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>().</p>


<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QGraphicsSimpleTextItem.boundingRect (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#boundingRect">QGraphicsItem.boundingRect</a>().</p>


<h3 class="fn"><a name="contains" />bool QGraphicsSimpleTextItem.contains (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#contains">QGraphicsItem.contains</a>().</p>


<h3 class="fn"><a name="font" /><a href="qfont.html">QFont</a> QGraphicsSimpleTextItem.font (<i>self</i>)</h3><p>Returns the font that is used to draw the item's text.</p>
<p><b>See also</b> <a href="qgraphicssimpletextitem.html#setFont">setFont</a>().</p>


<h3 class="fn"><a name="isObscuredBy" />bool QGraphicsSimpleTextItem.isObscuredBy (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>item</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#isObscuredBy">QGraphicsItem.isObscuredBy</a>().</p>


<h3 class="fn"><a name="opaqueArea" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsSimpleTextItem.opaqueArea (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#opaqueArea">QGraphicsItem.opaqueArea</a>().</p>


<h3 class="fn"><a name="paint" />QGraphicsSimpleTextItem.paint (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a>&#160;<i>option</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem.paint</a>().</p>


<h3 class="fn"><a name="setFont" />QGraphicsSimpleTextItem.setFont (<i>self</i>, <a href="qfont.html">QFont</a>&#160;<i>font</i>)</h3><p>Sets the font that is used to draw the item's text to
<i>font</i>.</p>
<p><b>See also</b> <a href="qgraphicssimpletextitem.html#font">font</a>().</p>


<h3 class="fn"><a name="setText" />QGraphicsSimpleTextItem.setText (<i>self</i>, QString&#160;<i>text</i>)</h3><p>Sets the item's text to <i>text</i>. The text will be displayed
as plain text. Newline characters ('\n') as well as characters of
type <a href="qchar.html#SpecialCharacter-enum">QChar.LineSeparator</a> will
cause item to break the text into multiple lines.</p>
<p><b>See also</b> <a href="qgraphicssimpletextitem.html#text">text</a>().</p>


<h3 class="fn"><a name="shape" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsSimpleTextItem.shape (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#shape">QGraphicsItem.shape</a>().</p>


<h3 class="fn"><a name="text" />QString QGraphicsSimpleTextItem.text (<i>self</i>)</h3><p>Returns the item's text.</p>
<p><b>See also</b> <a href="qgraphicssimpletextitem.html#setText">setText</a>().</p>


<h3 class="fn"><a name="type" />int QGraphicsSimpleTextItem.type (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#type">QGraphicsItem.type</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>